<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>售后服务</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/layuimini.css?v=2.0.4.2}" media="all">
    <link rel="stylesheet" th:href="@{/css/themes/default.css}" media="all">
    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
    <style>
        .div-content{

            background-color:white;
            border-radius: 5px;
            padding: 15px;

        }
        .table-search-fieldset {
            margin: 0;
            border: 1px solid #e6e6e6;
            padding: 10px 20px 5px 20px;
            color: #6b6b6b;
        }
    </style>
</head>
<body>
<div class="div-content">
    <form class="layui-form layui-form-pane" id="form-search" style="margin-bottom: 20px">
        <fieldset class="table-search-fieldset">
            <legend>
                搜索条件
            </legend>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">编号：</label>
                    <div class="layui-input-inline" style="width: 150px;">
                        <input type="text" name="commodity" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">姓名：</label>
                    <div class="layui-input-inline" style="width: 150px;">
                        <input type="text" name="name" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">手机号：</label>
                    <div class="layui-input-inline" style="width: 150px;">
                        <input type="text" name="phone" autocomplete="off" class="layui-input">
                    </div>
                </div>



            </div>
            <div class="layui-form-item">



                <div class="layui-inline" style="margin-left: 1000px">
                    <button id="btn-search" lay-submit lay-filter="bt-search-filter" type="button" class="layui-btn layui-btn-radius layui-btn-normal">
                        <i class="layui-icon layui-icon-search"></i>
                        查询
                    </button>
                    <button id="btn-reset"  type="reset" class="layui-btn layui-btn-radius  layui-btn-primary">
                        <i class="layui-icon layui-icon-fonts-clear"></i>
                        重置
                    </button>
                </div>
            </div>
        </fieldset>

    </form>
    <table id="table-after" lay-filter="table-after-filter"></table>

</div>

<script th:src="@{/webjars/jquery/3.5.1/jquery.min.js}" charset="utf-8"></script>
<script th:src="@{/layui/layui.js}" charset="utf-8"></script>
<script th:inline="javascript">
    var ctxPath = [[@{/}]];
        // 表单
        layui.use(['form','table'], function(){
            var form = layui.form
                ,table = layui.table
            var $ = layui.$;

            // 监听查询
            form.on('submit(bt-search-filter)', function (data) {

                console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
                // 刷新表格
                table.reload('table-after', {
                    where: { //设定异步数据接口的额外参数，任意设
                        commodity: data.field.commodity,
                        name: data.field.name,
                        phone: data.field.phone

                        //…
                    }
                    ,page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });

                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });

            //员工列表表格渲染
            table.render({
                elem: '#table-after'
                , url: ctxPath + 'out/list' //数据接口
                , page: true //开启分页
                , height: 'full-135'
                , limits: [10, 20, 30, 50, 100]
                , limit: 13
                , cols: [[ //表头

                    {field: 'commodity', title: '编号', sort: true, align: 'center'}
                    , {field: 'name', title: '姓名', align: 'center'}
                    , {field: 'phone', title: '手机号', align: 'center'}
                    , {field: 'date', title: '出货日期', align: 'center'}
                    , {field: 'obj', title: '销售对象', align: 'center'}
                    , {field: 'quantity', title: '数量', align: 'center'}
                    , {field: 'sal', title: '金额', align: 'center'}
                    , {field: 'people', title: '负责人', align: 'center'}
                    , {field: 'record', title: '备注', width: 500, align: 'center'}
                ]]
            });



        });




</script>
</body>
</html>